package com.awifi.com.thread.count;

/**
 * @description: 线程实现每10个数输出一个字符串，每秒休息
 * @author: marin
 * @time: 2020/6/29 8:21
 */
public class CountThread implements Runnable {
    String str = "";

    @Override
    public void run() {
        for (int i = 1;i<= 100;i++) {
            str += String.valueOf(i);
            try {
                Thread.sleep(1000);
            }catch (Exception e){
                e.printStackTrace();
            }
            if(i%10 ==0){
                System.out.println(str);
                str = "";
            }
        }
    }
}
